package co.edu.usbcali.egrapico.vista.tools;

import co.edu.usbcali.egrapico.vista.FrmPrincipal;
import co.edu.usbcali.egrapico.vista.ambient.*;

public class JPanelTranferHandlerProgram extends StringTransferHandler {

    protected void importString(javax.swing.JComponent c, String str) {
        PanelProgram target = (PanelProgram) c;
        try {
            target.setSelected(true);
        } catch (java.beans.PropertyVetoException e) {
        }

        javax.swing.ImageIcon I1 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/context.gif"));
        javax.swing.ImageIcon I2 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/ask.gif"));
        javax.swing.ImageIcon I3 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/tell.gif"));
        javax.swing.ImageIcon I4 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/msgSend.gif"));
        javax.swing.ImageIcon I5 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/object.gif"));
        LabelContext label = new LabelContext();
        LabelAsk label2 = new LabelAsk();
        LabelTell label3 = new LabelTell();
        LabelMsgSend label4 = new LabelMsgSend();
        LabelObject label5 = new LabelObject();
        if (str.equals("Context")) {
            label.setIcon(I1);
            label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label.setName(str);
            label.setLocation(target.getLPane().getMousePosition());
            label.setSize(90, 90);

            label.repaint();
            target.addLayeredPane(label);
        } else if (str.equals("Ask")) {
            label2.setIcon(I2);
            label2.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label2.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label2.setName(str);
            label2.setLocation(target.getLPane().getMousePosition());
            label2.setSize(90, 100);
            target.addLayeredPane(label2);
        } else if (str.equals("Tell")) {
            label3.setIcon(I3);
            label3.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label3.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label3.setName(str);
            label3.setLocation(target.getLPane().getMousePosition());
            label3.setSize(90, 100);
            target.addLayeredPane(label3);
        } else if (str.equals("MsgSend")) {
            label4.setIcon(I4);
            label4.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label4.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label4.setName(str);
            label4.setLocation(target.getLPane().getMousePosition());
            label4.setSize(90, 100);
            target.addLayeredPane(label4);

        } else if (FrmPrincipal.esObjeto(str)) {

            label5.setIcon(I5);
            label5.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label5.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label5.setName(str);
            label5.setLocation(target.getLPane().getMousePosition());
            label5.setSize(90, 90);
            target.addLayeredPane(label5);
            if (FrmPrincipal.getObjeto(str).parsingC(str))//ealiza el analisis deprendiente de contexto 
            {
                target.getLPane().remove(label5);
            }
        }
    }
}
